from pydantic import BaseModel, Field
from typing import Optional


class Category(BaseModel):
    id: int


class CategoryCreate(BaseModel):
    name: str = Field(example="类别名称")
    code: str = Field(example="类别编码")
    desc: Optional[str] = Field('类别描述', example="类别描述")
    status: Optional[str] = Field('1', example='1')
    order: Optional[int] = Field(1, example=1)


class CategoryUpdate(BaseModel):
    id: int
    name: str = Field(example="类别名称")
    code: str = Field(example="类别编码")
    desc: Optional[str] = Field('类别描述', example="类别描述")
    status: Optional[str] = Field('1', example='1')
    order: Optional[int] = Field(1, example=1)
